package domain;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Set;


/**
 * The persistent class for the continent database table.
 * 
 */
@Entity
@Table(name="continent")
@NamedQueries({
    @NamedQuery(name = "Continent.findAll", query = "SELECT c FROM Continent c ORDER BY c.continent"),
    @NamedQuery(name = "Continent.findByContinentId", query = "SELECT c FROM Continent c WHERE c.continentId = :continent_id")})
public class Continent implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="continent_id", unique=true, nullable=false)
	private int continentId;

	@Column(nullable=false, length=50)
	private String continent;

	//bi-directional many-to-one association to Land
	@OneToMany(mappedBy="continent", fetch=FetchType.EAGER)
	private Set<Land> lands;

    public Continent() {
    }

	public int getContinentId() {
		return this.continentId;
	}

	public void setContinentId(int continentId) {
		this.continentId = continentId;
	}

	public String getContinent() {
		return this.continent;
	}

	public void setContinent(String continent) {
		this.continent = continent;
	}

	public Set<Land> getLands() {
		return this.lands;
	}

	public void setLands(Set<Land> lands) {
		this.lands = lands;
	}

	@Override
	public boolean equals(Object obj) {
		return (obj!=null && obj instanceof Continent && ((Continent)obj).getContinentId()==getContinentId());
	}

	@Override
	public String toString() {
		return getContinent();
	}
}